/*
 * jquery.inputmask.regex.extensions.js
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2014 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Version: 3.1.23
 */
!function (a) {
    "function" == typeof define && define.amd ? define(["jquery", "./jquery.inputmask"], a) : a(jQuery)
}(function (a) {
    return a.extend(a.inputmask.defaults.aliases, {
        Regex: {
            mask: "r",
            greedy: !1,
            repeat: "*",
            regex: null,
            regexTokens: null,
            tokenizer: /\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,
            quantifierFilter: /[0-9]+[^,]/,
            isComplete: function (a, b) {
                return new RegExp(b.regex).test(a.join(""))
            },
            definitions: {
                r: {
                    validator: function (b, c, d, e, f) {
                        function g(a, b) {
                            this.matches = [], this.isGroup = a || !1, this.isQuantifier = b || !1, this.quantifier = {
                                min: 1,
                                max: 1
                            }, this.repeaterPart = void 0
                        }

                        function h() {
                            var a, b, c = new g, d = [];
                            for (f.regexTokens = []; a = f.tokenizer.exec(f.regex);)switch (b = a[0], b.charAt(0)) {
                                case"(":
                                    d.push(new g(!0));
                                    break;
                                case")":
                                    var e = d.pop();
                                    d.length > 0 ? d[d.length - 1].matches.push(e) : c.matches.push(e);
                                    break;
                                case"{":
                                case"+":
                                case"*":
                                    var h = new g(!1, !0);
                                    b = b.replace(/[{}]/g, "");
                                    var i = b.split(","), j = isNaN(i[0]) ? i[0] : parseInt(i[0]), k = 1 == i.length ? j : isNaN(i[1]) ? i[1] : parseInt(i[1]);
                                    if (h.quantifier = {min: j, max: k}, d.length > 0) {
                                        var l = d[d.length - 1].matches;
                                        if (a = l.pop(), !a.isGroup) {
                                            var e = new g(!0);
                                            e.matches.push(a), a = e
                                        }
                                        l.push(a), l.push(h)
                                    } else {
                                        if (a = c.matches.pop(), !a.isGroup) {
                                            var e = new g(!0);
                                            e.matches.push(a), a = e
                                        }
                                        c.matches.push(a), c.matches.push(h)
                                    }
                                    break;
                                default:
                                    d.length > 0 ? d[d.length - 1].matches.push(b) : c.matches.push(b)
                            }
                            c.matches.length > 0 && f.regexTokens.push(c)
                        }

                        function i(b, c) {
                            var d = !1;
                            c && (k += "(", m++);
                            for (var e = 0; e < b.matches.length; e++) {
                                var f = b.matches[e];
                                if (1 == f.isGroup)d = i(f, !0); else if (1 == f.isQuantifier) {
                                    var g = a.inArray(f, b.matches), h = b.matches[g - 1], j = k;
                                    if (isNaN(f.quantifier.max)) {
                                        for (; f.repeaterPart && f.repeaterPart != k && f.repeaterPart.length > k.length && !(d = i(h, !0)););
                                        d = d || i(h, !0), d && (f.repeaterPart = k), k = j + f.quantifier.max
                                    } else {
                                        for (var l = 0, o = f.quantifier.max - 1; o > l && !(d = i(h, !0)); l++);
                                        k = j + "{" + f.quantifier.min + "," + f.quantifier.max + "}"
                                    }
                                } else if (void 0 != f.matches)for (var p = 0; p < f.length && !(d = i(f[p], c)); p++); else {
                                    var q;
                                    if ("[" == f.charAt(0)) {
                                        q = k, q += f;
                                        for (var r = 0; m > r; r++)q += ")";
                                        var s = new RegExp("^(" + q + ")$");
                                        d = s.test(n)
                                    } else for (var t = 0, u = f.length; u > t; t++)if ("\\" != f.charAt(t)) {
                                        q = k, q += f.substr(0, t + 1), q = q.replace(/\|$/, "");
                                        for (var r = 0; m > r; r++)q += ")";
                                        var s = new RegExp("^(" + q + ")$");
                                        if (d = s.test(n))break
                                    }
                                    k += f
                                }
                                if (d)break
                            }
                            return c && (k += ")", m--), d
                        }

                        null == f.regexTokens && h();
                        var j = c.buffer.slice(), k = "", l = !1, m = 0;
                        j.splice(d, 0, b);
                        for (var n = j.join(""), o = 0; o < f.regexTokens.length; o++) {
                            var g = f.regexTokens[o];
                            if (l = i(g, g.isGroup))break
                        }
                        return l
                    }, cardinality: 1
                }
            }
        }
    }), a.fn.inputmask
});